lunomobs:register_mob("lunomobs:gossamer", {
	mob_name="GOSSAMER",
	type = "monster",
	hp_max = 25, --Padrão = 10
	armor = 200, --Padrao = 60
	xp_give = 50,
	collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.6, 0.7},
	visual = "mesh",
	mesh = "mobs_dungeon_master.x",
	textures = {"mobs_dungeon_master.png"},
	visual_size = {x=8, y=8},
	makes_footstep_sound = true,
	view_range = 30, --Padrão: 15
	walk_velocity = 1,
	run_velocity = 3,
	damage = 4,
	drops = {
		--{name="default:mese", chance=100, min=1, max=2,},
		{name="default:mese_crystal", chance=1, min=1, max=2,},
		{name="default:diamond", chance=10, min=1, max=2,},
	},
	drawtype = "front",
	water_damage = 5,
	lava_damage = 5,
	light_damage = 0,
	on_rightclick = nil,
	attack_type = "shoot",
	arrow = "lunomobs:fireball",
	shoot_interval = 2.5,
	sounds = {
		random = "mobs_gossamer",
		attack = "mobs_fireball",
	},
	animation = {
		stand_start = 0,
		stand_end = 19,
		walk_start = 20,
		walk_end = 35,
		punch_start = 36,
		punch_end = 48,
		speed_normal = 15,
		speed_run = 15,
	},
})
lunomobs:register_spawn("lunomobs:gossamer", {"default:stone","watershed:stone"}, 2, -1, 7000, 1, -50)

lunomobs:register_arrow("lunomobs:fireball", {
	visual = "sprite",
	visual_size = {x=1, y=1},
	--textures = {{name="particle_fireball.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.5}}}, FIXME
	textures = {"particle_fireball.png"},
	velocity = 8,
	hit_player = function(self, player)
		local s = self.object:getpos()
		local p = player:getpos()
		local vec = {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z}
		player:punch(self.object, 1.0,  {
			full_punch_interval=1.0,
			damage_groups = {fleshy=4},
		}, vec)
		local pos = self.object:getpos()
		minetest.sound_play("mobs_fireball_hitplayer", {object=player, max_hear_distance = 30})  
		for dx=-1,1 do
			for dy=-1,1 do
				for dz=-1,1 do
					local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
					local n = minetest.env:get_node(pos).name
					if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 30 then
						minetest.env:set_node(p, {name="fire:basic_flame"})
					else
						minetest.env:remove_node(p)
					end
				end
			end
		end
	end,
	hit_node = function(self, pos)
		minetest.sound_play("mobs_fireball_hitnode", {pos=pos, max_hear_distance = 30})  
		for dx=-1,1 do
			for dy=-2,1 do
				for dz=-1,1 do
					local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
					local n = minetest.env:get_node(pos).name
					if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 30 then
						minetest.env:set_node(p, {name="fire:basic_flame"})
					else
						minetest.env:remove_node(p)
					end
				end
			end
		end
	end
})

minetest.register_craftitem("lunomobs:gossamer", {
	description = "Gossamer(BOSS)", --Gossamer (O Destruidor)
	groups = { mobs=1 },
	inventory_image = "mob_gossamer.png",
	on_place = function(itemstack, placer, pointed_thing)
		if pointed_thing.above then
			minetest.env:add_entity(pointed_thing.above, "lunomobs:gossamer")
			itemstack:take_item()
		end
		return itemstack
	end,
})

